# coding: utf-8
# author: dengpanxiao(@126.com)
# flask，比较流行的Python web框架，使用MVC实现
from flask import Flask, request, render_template

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('home.html')

@app.route('/signin', methods=['GET'])
def signin_form():
    return render_template('form.html')

@app.route('/signin', methods=['POST'])
def signin():
    if request.form['username'] == 'dengpanxiao' and request.form['password'] == "777888":
        return render_template('sign_ok.html', username = request.form['username'])
    else:
        return render_template('form.html', message='Your username or password is wrong!', username = request.form['username'])

if __name__ == '__main__':
    app.run()
